斐讯 N1 您所在的位置:网站首页 n1 系统 斐讯 N1

斐讯 N1

2023-05-15 01:39| 来源: 网络整理| 查看: 265

本帖最后由 rocket 于 2020-10-17 10:02 编辑

环境:本人是N1+32G U盘(不写EMMC是因为不想折腾,而且U盘空间比EMMC大)

一、系统镜像的下载地址: 链接: https://pan.baidu.com/s/12yjJPYb0zJC_NsWkej_d9Q 提取码: dmp7

下载的是5.91的debian非桌面版:Armbian_5.91_Aml-g12_Debian_buster_default_5.2.1_20190724.img.xz

【刷机教程】:斐讯 N1 速刷 Armbian5.88 + HomeAssistant 看完写入U盘后记得回来继续看

二、armbian的默认账号密码: 用户:root 密码:1234 获取IP:方便SSH,我可不想直接在终端操作

ifconfig eth0 | grep -w inet | awk '{print $2}' 注:由于本人直接在root下操作,所以很多命令是没有sudo前缀,如果自己新建了用户,请自行添加!

三、优化 1、设置时区

echo "Asia/Shanghai" > /etc/timezone && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 2、优化DNS echo -e "nameserver 223.5.5.5 \nnameserver 119.29.29.29" > /etc/resolvconf/resolv.conf.d/head rm /etc/resolv.conf && ln -s /run/resolvconf/resolv.conf /etc/resolv.conf resolvconf -u

3、优化Debian软件安装源

vi /etc/apt/sources.list #注释官方源,增加中国科学技术大学debian源debdeb http://mirrors.ustc.edu.cn/debian stretch  main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian stretch main contrib non-free deb http://mirrors.ustc.edu.cn/debian stretch-updates main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian stretch-updates main contrib non-free deb http://mirrors.ustc.edu.cn/debian stretch-backports  main contrib non-free deb-src http://mirrors.ustc.edu.cn/debian stretch-backports main contrib non-free 4、配置语言(方便使用linux编辑器的时候使用中文) armbian-config → personal → Locales 进入语言选择界面: 用空格增加选中zh_CN.GBK GBK、zh_CN.UTF-8 UTF-8,耐心等待完成,完成后按ESC返回终端 修改配置文件/etc/environment vi /etc/environment

#environment文件内容如下

ARCH=arm64 LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" 让配置生效 source /etc/environment

四、蓝牙安装及开启 armbian-config → Network → BT install 安装完毕后ESC返回终端继续安装

apt-get install python3-pip libglib2.0-dev python3-setuptools pip3 install bluepy #安装过程有报错,但最终提示成功安装 bluetoothctl #确保蓝牙正常运作 bluetooth]# power on [bluetooth]# scan on #能扫描到蓝牙设备则代表正常工作了 [bluetooth]# power off #关闭吧,开着浪费电

五、mosquitto安装及配置(HA官方建议使用mosquitto) 注:主要参考囧大的帖子《[进阶教程] Ubuntu/Debian/树莓派安装MQTT(无坑版)》,在此基础上增加一些N1的填坑操作!

apt-get install mosquitto #停止MQTT服务并进行配置 service mosquitto stop #修改日志路径log_dest N1坑:我们使用的固件中,/var/log的空间只有49M,而通过apt安装的mosquitto默认配置log是指向/var/log,当日志增长导致空间不足时,mosquitto就会挂掉,因此需要修改配置) mkdir -p /opt/mosquitto/log #创建mosquitto的日志目录 chown mosquitto.mosquitto -Rh /opt/mosquitto/log #修改目录权限,不然mosquitto无法写入日志 vi /etc/mosquitto/mosquitto.conf #修改MQTT配置文件,找到log_dest file,修改为正确路径 mosquitto.conf完整内容: pid_file /var/run/mosquitto.pid persistence true persistence_location /var/lib/mosquitto/ log_dest file /opt/mosquitto/log/mosquitto.log include_dir /etc/mosquitto/conf.d #创建mqtt.conf配置文件(注:路径就不要随意更改了,不然还修改/etc/mosquitto/mosquitto.conf) sudo nano /etc/mosquitto/conf.d/mqtt.conf #文件内容(照搬囧大的):port 1883 listener 1884 protocol websockets allow_anonymous false password_file /etc/mosquitto/pwfile #保存文件后,设置用户和密码,最后的mqtt为用户,可自行修改,回车后输入两次相同的密码 sudo mosquitto_passwd -c /etc/mosquitto/pwfile mqtt #设置开机启动 service mosquitto enable #启动MQTT服务 sudo /etc/init.d/mosquitto start

六、HASSIO 安装一键脚本 注:原帖:neroxps的《[HASS.IO] HASSIO 安装一键脚本》 ,这里只列出我使用的命令

curl -sL -o install.sh https://raw.githubusercontent.com/neroxps/hassio_install/master/install.sh chmod a+x install.sh ./install.sh 我选择的配置项: ############################ # 1. 是否将系统源切换为中科大(USTC)源: 是(前面手工改过,这里其实可以选否) # 2. 是否将用户添加至 Docker 用户组:   是,添加用户为 systemd-coredump # 3. 是否将 Docker 源切换至国内源:     是,切换源选择:docker-cn # 4. 您的设备类型为:                   qemuarm-64 # 5. 您的 hassio 数据路径为:           /opt/hassio ############################

七、HASSIO 的基础设置修改 注:由于安装时自定义数据路径/opt/hassio,默认的是/usr/share,请根据自己的实际环境进行调整调整核心配置文件

vi /opt/hassio/homeassistant/configuration.yaml 文件末尾增加以下内容(其他内容不要动)homeassistant、mqtt、recorder、tts 前面均没有空格,自行注意yaml格式! homeassistant: packages: !include_dir_named packages mqtt: broker: XXX.XXX.XXX.XXX port: 1883 username: mqtt password: password recorder: purge_interval: 2 purge_keep_days: 7 tts: - platform: baidu app_id: xxxxxx api_key: xxxxxx secret_key: xxxxxx speed: 5 pitch: 6 volume: 15 person: 0

说明: 1)homeassistant用于包含packages配置,方便模块独立维护在不同yaml文件。 2)mqtt内的broker填写自己的mqtt服务器的ip地址。 3)recorder用于配置日志: purge_keep_days指定清除后要保留在记录器数据库中的历史天数,默认10; purge_interval配置清除任务的运行频率,默认为1(每天清除)。 4)tts,用百度的某哥在国内用不了



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有